home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209b.zip / octave-2.09 / DLFCN.ZIP / dlfcn / octave / SLStack.h < prev    next >
C/C++ Source or Header  |  1997-08-20  |  2KB  |  90 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. /*
  24.  
  25. The classes in this file are derived from the old `genclass' version
  26. of SLStack from libg++, originally:
  27.  
  28.   Copyright (C) 1988 Free Software Foundation
  29.     written by Doug Lea (dl@rocky.oswego.edu)
  30.  
  31. and distributed under the terms of the GNU Library General Public
  32. License as published by the Free Software Foundation.
  33.  
  34. */
  35.  
  36. #if !defined (_SLStack_h)
  37. #define _SLStack_h 1
  38.  
  39. #if defined (__GNUG__)
  40. #pragma interface
  41. #endif
  42.  
  43. #include "SLList.h"
  44. #include "Stack.h"
  45.  
  46. template <class T>
  47. class
  48. SLStack : public Stack<T>
  49. {
  50. private:
  51.  
  52.   SLList<T> p;
  53.  
  54. public:
  55.  
  56.   SLStack (void) : p () { }
  57.  
  58.   SLStack (const SLStack<T>& s) : p (s.p) { }
  59.  
  60.   ~SLStack (void) { }
  61.  
  62.   SLStack<T>& operator = (const SLStack<T>& s);
  63.  
  64.   void push (const T& item) { p.prepend (item); }
  65.  
  66.   T pop (void) { return p.remove_front (); }
  67.  
  68.   T& top (void) { return p.front (); }
  69.  
  70.   void del_top (void) { p.del_front (); }
  71.  
  72.   int empty (void) { return p.empty (); }
  73.  
  74.   int full (void) { return 0; }
  75.  
  76.   int length (void) { return p.length (); }
  77.  
  78.   void clear (void) { p.clear (); }
  79.  
  80.   int OK (void) { return p.OK (); }
  81. };
  82.  
  83. #endif
  84.  
  85. /*
  86. ;;; Local Variables: ***
  87. ;;; mode: C++ ***
  88. ;;; End: ***
  89. */
  90.